package com.bw.mapper;

import com.bw.bean.Vo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface VoMapper {
    //业务层成功注入数据层
    //数据层接口定义正确
    @Select("select\n" +
            "    c.name,sum(oi.final_total_amount)`value`\n" +
            "from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on si.id = od.sku_id\n" +
            "left join base_category3 b on b.id = si.category3_id\n" +
            "left join base_category2 c on c.id = b.category2_id\n" +
            "group by c.name")
    List<Vo> getlist1();
    @Select("select\n" +
            "    bt.name,sum(oi.final_total_amount) `value`\n" +
            "from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on si.id = od.sku_id\n" +
            "left join base_trademark bt on bt.id = si.tm_id\n" +
            "group by bt.name\n" +
            "order by sum(oi.final_total_amount)")
    List<Vo> getlist2();
    @Select("call sq1()")
    Double getlist3();
    @Select("select\n" +
            "    s.spu_name `name`,sum(final_total_amount) `value`\n" +
            "from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on si.id = od.sku_id\n" +
            "left join spu_info s on s.id = si.spu_id\n" +
            "group by s.spu_name")
    List<Vo> getlist4();
}
